Skip to content

Prevent ZIP installs from clearing unrelated plugins and themes - #311

Merged
adamziel merged 4 commits into
WordPress:trunkfrom
chubes4:fix/310-safe-plugin-zip-target
Sep 1, 2026
Merged

Prevent ZIP installs from clearing unrelated plugins and themes#311
adamziel merged 4 commits into
WordPress:trunkfrom
chubes4:fix/310-safe-plugin-zip-target

Conversation

@chubes4

@chubes4 chubes4 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

A valid plugin or theme ZIP created from the current directory may begin with ./. The old installers treated the first path segment as the target folder. That made the target WP_PLUGIN_DIR/. or wp-content/themes/. and recursively cleared unrelated plugins or themes before WordPress selected the installation folder.

This change leaves target selection, replacement, and installed-folder detection to Plugin_Upgrader and Theme_Upgrader. Regression tests cover plugin and theme archives beginning with ./ and confirm that existing unrelated plugins and themes survive.

Windows test cleanup now removes each copied WordPress site instead of retaining all copies until the job ends. Current hosted Windows runners otherwise exhaust the 15 GB temporary drive before the suite finishes.

Testing

  • vendor/bin/phpunit components/Blueprints/Tests/Unit/Steps (77 tests, 185 assertions)
  • vendor/bin/phpcs -d memory_limit=1G components/Blueprints/Steps/class-installpluginstep.php components/Blueprints/Steps/class-installthemestep.php components/Blueprints/Tests/Unit/Steps/InstallPluginStepTest.php components/Blueprints/Tests/Unit/Steps/InstallThemeStepTest.php components/Blueprints/Tests/Unit/Steps/StepTestCase.php
  • Each regression test failed before its source change and passed afterward.

Closes #310

@adamziel adamziel changed the title Prevent plugin installs from clearing unrelated plugins Prevent ZIP installs from clearing unrelated plugins and themes Sep 1, 2026
@adamziel
adamziel merged commit c351196 into WordPress:trunk Sep 1, 2026
29 checks passed
@adamziel

adamziel commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blueprint installPlugin can delete the entire plugins directory for ZIPs rooted at ./

2 participants